package edu.csci3308.ekwhite.bigintegers.test;

import static org.junit.Assert.*;
import junit.framework.Assert;

import org.junit.Test;

import edu.csci3308.ekwhite.bigintegers.BigInteger;


public class BigIntegerTest1 {

	@Test
	public void test() {
		BigInteger test1 = new BigInteger();
		BigInteger test2 = new BigInteger(0);
		
		if (!test1.equals(test2))
			fail("Default constructor " + test1.toString() + " and int constructor with zero " + test2.toString() + " don't give same answer");
		
		BigInteger test3 = new BigInteger("0");
		if (!test1.equals(test3))
			fail("Default constructor " + test1.toString() + " and string constructor with zero "  + test3.toString() + " don't give same answer");
			
		BigInteger test4 = new BigInteger(776);
		BigInteger test5 = new BigInteger(777);
		
		Assert.assertTrue(test4.compareTo(test5) < 0);
		Assert.assertTrue(test4.equals(test5) == false);
		
		BigInteger test6 = test5;
		test5 = test5;
		Assert.assertTrue(test6.equals(test5));
		
		BigInteger test7 = test4.add(test5);
		System.out.println(test7.toString());
		BigInteger test8 = new BigInteger("1553");
		
		if (!test7.equals(test8))
			fail("Addition of " + test4.toString() + " and "  + test5.toString() + " doesn't give the answer, " + test8.toString() + ", but " + test7.toString());
		
		BigInteger test9 = test4.subtract(test5);
		BigInteger test10 = new BigInteger("-1");
		if (!(test9.equals(test10)))
			fail("Subtraction of " + test5.toString() + " from "  + test4.toString() + " doesn't give the answer," + test10.toString() + ", but " + test9.toString());
		
		BigInteger test11 = test5.subtract(test4);
		BigInteger test12 = new BigInteger("1");
		
		if (!(test11.equals(test12)))
			fail("Subtraction of " + test4.toString() + " from "  + test5.toString() + " doesn't give the answer," + test12.toString()+ ", but " + test11.toString());
			
	}

}
